using UnityEngine;
using QFramework;

namespace ProjectSurvivor
{
	public partial class Bomb : ViewController//表示一个挂在场景物体上的控制器（如玩家、刷怪器）。
	{
		void OnTriggerEnter2D(Collider2D other)
		{
			
			if (other.GetComponent<CollectableArea>())
			{
				AudioKit.PlaySound("bomb");
				foreach (var enemyObj in UnityEngine.GameObject.FindGameObjectsWithTag("Enemy"))
				{
					
						if (enemyObj.GetComponent<Enemy>()&&enemyObj.gameObject.activeSelf)
						{
							DamageSystem.CalculateDamage(Global.SimpleAbilityDamage.Value, enemyObj.GetComponent<Enemy>());
						}
						else if (enemyObj.GetComponent<EnemyMinBoss>()&&enemyObj.gameObject.activeSelf)
						{
							DamageSystem.CalculateDamage(Global.SimpleAbilityDamage.Value, enemyObj.GetComponent<EnemyMinBoss>());
						}
					
				}
				UIGamePlanel.FlashSreen.Trigger();
				CameraController.Shake();
				this.DestroyGameObjGracefully();


			}
        }
	}
}
